package com.douma._2022_7_3;

import java.util.*;


/**
 * 抖码算法，让算法学习变的简单有趣
 *
 * @作者 : 老汤
 */
public class 构成的正方形数量 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();
        // 小于 4 个点，不足以构成正方形
        if (n < 4) {
            System.out.println(0);
            return;
        }

        int[][] points = new int[n][2];
        for (int i = 0; i < n; i++) {
            points[i][0] = sc.nextInt();
            points[i][1] = sc.nextInt();
        }

        // 因为题目规定的输入数据规模是 100，所以可以暴力枚举
        int res = 0;
        for (int i = 0; i < n - 3; i++) {
            for (int j = i + 1; j < n - 2; j++) {
                for (int k = j + 1; k < n - 1; k++) {
                    for (int l = k + 1; l < n; l++) {
                        // 验证四个点是否是正方形
                        if (validSquare(points[i], points[j], points[k], points[l])) {
                            res++;
                        }
                    }
                }
            }
        }
        System.out.println(res);

        sc.close();
    }

    // 如何验证四个点是否是正方形，请参考：https://leetcode.cn/problems/valid-square/solution/you-xiao-de-zheng-fang-xing-by-leetcode/
    private static boolean validSquare(int[] p1, int[] p2, int[] p3, int[] p4) {
        return check(p1, p2, p3, p4) || check(p1, p3, p2, p4) || check(p1, p2, p4, p3);
    }

    private static boolean check(int[] p1, int[] p2, int[] p3, int[] p4) {
        return dist(p1, p2) > 0
                && dist(p1, p2) == dist(p2, p3)
                && dist(p2, p3) == dist(p3, p4)
                && dist(p3, p4) == dist(p4, p1)
                && dist(p1, p3) == dist(p2, p4);
    }

    private static double dist(int[] p1, int[] p2) {
        return (p2[1] - p1[1]) * (p2[1] - p1[1]) + (p2[0] - p1[0]) * (p2[0] - p1[0]);
    }

}
